package fingerGuessing;

import java.util.Scanner;

public class User extends Role{
    /**
     * 用户类
     */
    @Override
    public int fingerguessing() {
        Scanner scan =new Scanner(System.in);
        int number=-1;
        while (true){
            System.out.println("请输入剪刀：0，石头：1，布：2");
            try {
                number=scan.nextInt();
                if (number<0||number>2){
                    System.out.println("输入错误，请重新输入.");
                }else{
                    break;
                }
            }catch (Exception e){
                System.out.println("输入错误，请重新输入.");
                scan.next();
            }
        }
        return number;
    }
}
